$(document).ready(function(){

});

function init(){

    $.ajax({
        url: "/supplier/findAll",
        type: 'GET',
        data: {},
        dataType: "JSON",
        async: false,
        success: function (res) {
            if(res.code == "200") {
                var html = "";
                var data = res.data;
                for (var i = 0; i < data.length; i ++){
                    html += "<tr>";
                    html += "<td>" + data[i].name + "</td>";
                    html += "<td>" + data[i].supplierName + "</td>";
                    html += "<td>" + data[i].product + "</td>";
                    html += "<td>" + data[i].address + "</td>";
                    html += "<td>" + data[i].createTime + "</td>";
                    html += "<td><img style='height: 80px' src=" + data[i].addressPhoto + "></td>";
                    html += "<td>";
                    html += "<button class='btn btn-primary' onclick='updateById(" + data[i].id + ")'>修改 </button>";
                    html += "<button class='btn btn-primary' onclick='findById(" + data[i].id + ")'>查看 </button>";
                    html += "<button class='btn btn-primary' onclick='deleteById(" + data[i].id + ")'>删除 </button>";
                    html += "</td>";
                    html += "</tr>";

                }

                $(".tbody").html(html);
                2
            } else {
                alert(res.msg);
            }
        },
        error: function (e) {
            alert('发生错误')
        }
    })

}
